package com.eipv.multidatasource.component.task;

import com.alibaba.fastjson.JSONObject;
import com.eipv.component.mybatis.base.entity.BaseEntity;
import com.eipv.multidatasource.component.cache.QueueCache;
import com.eipv.multidatasource.controller.WebSocketServerController;

public class PushMonitorTask implements Runnable {

    @Override
    public void run() {
        while (true) {
            try {
                BaseEntity monitor = QueueCache.MONITOR_QUEUE.take();
                WebSocketServerController.sendInfo(JSONObject.toJSONString(monitor), "10000");
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }
    }
}

